﻿using System.Reflection;
using AndyPike.Commons.Web.MonoRail;
using AndyPike.Snowflake.Core.Services;
using Castle.MonoRail.Framework.Routing;

namespace AndyPike.Snowflake.Web
{
    public class Global : MonoRailNHibernateHttpApplication
    {
        public Global() : base(Assembly.Load("AndyPike.Snowflake.Entities"))
        {
        }

        public override void RegisterApplicationComponents()
        {
            container.AddComponent<IAccountService, AccountService>();
        }

        public override void RegisterRoutes(RoutingEngine rules)
        {
            rules.Add(new PatternRoute("[controller]/[action]")
                .DefaultForArea().IsEmpty
                .DefaultForController().Is("Home")
                .DefaultForAction().Is("Index"));
        }
    }
}